<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 6.1.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">

<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic|JetBrains Mono:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"www.jnxss.top","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":"mac"},"back2top":{"enable":true,"sidebar":true,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":true,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="心怀梦想，永远奋斗">
<meta property="og:type" content="website">
<meta property="og:title" content="江南笑书生">
<meta property="og:url" content="http://www.jnxss.top/index.html">
<meta property="og:site_name" content="江南笑书生">
<meta property="og:description" content="心怀梦想，永远奋斗">
<meta property="og:locale" content="zh_CN">
<meta property="article:author" content="江南笑书生">
<meta property="article:tag" content="Java, Spring, Vue, 全栈">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://www.jnxss.top/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : true,
    isPost : false,
    lang   : 'zh-CN'
  };
</script>

  <title>江南笑书生</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">江南笑书生</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">殷贵庆的个人博客</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-commonweal">

    <a href="/404/" rel="section"><i class="fa fa-heartbeat fa-fw"></i>公益 404</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container"></div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="algolia-results">
  <div id="algolia-stats"></div>
  <div id="algolia-hits"></div>
  <div id="algolia-pagination" class="algolia-pagination"></div>
</div>

      
    </div>
  </div>

</div>
    </header>

    
  <div class="reading-progress-bar"></div>

  <a href="https://github.com/5ME" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content index posts-expand">
            
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://www.jnxss.top/2022/09/01/Spring-Boot-%E4%B8%AD%E7%9A%84-AOP-%E6%98%AF%E5%93%AA%E7%A7%8D%E4%BB%A3%E7%90%86%E6%A8%A1%E5%BC%8F%EF%BC%9F/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/my-avatar.png">
      <meta itemprop="name" content="江南笑书生">
      <meta itemprop="description" content="心怀梦想，永远奋斗">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="江南笑书生">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2022/09/01/Spring-Boot-%E4%B8%AD%E7%9A%84-AOP-%E6%98%AF%E5%93%AA%E7%A7%8D%E4%BB%A3%E7%90%86%E6%A8%A1%E5%BC%8F%EF%BC%9F/" class="post-title-link" itemprop="url">Spring Boot 中的 AOP 是哪种代理模式？</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2022-09-01 10:51:30" itemprop="dateCreated datePublished" datetime="2022-09-01T10:51:30+08:00">2022-09-01</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2023-04-22 11:45:48" itemprop="dateModified" datetime="2023-04-22T11:45:48+08:00">2023-04-22</time>
              </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>232</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>1 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>总结：</p>
<ul>
<li><p>Spring 中的 AOP，有接口默认就用 JDK 动态代理，没有接口就用 CGLIB 动态代理。</p>
<p>但可以设置 <code>@EnableAspectJAutoProxy(proxyTargetClass = true)</code> 强制使用 CGLIB。</p>
</li>
<li><p>Spring Boot 中的 AOP，<code>2.0</code> 之前与 Spring 一样；<code>2.0</code> 之后默认使用 CGLIB 动态代理，如需使用 JDK 动态代理，需在 <code>application.properties</code> 中配置 <code>spring.aop.proxy-target-class=false</code>。</p>
</li>
</ul>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://www.jnxss.top/2022/08/10/Knuth-%E6%B4%97%E7%89%8C%E7%AE%97%E6%B3%95/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/my-avatar.png">
      <meta itemprop="name" content="江南笑书生">
      <meta itemprop="description" content="心怀梦想，永远奋斗">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="江南笑书生">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2022/08/10/Knuth-%E6%B4%97%E7%89%8C%E7%AE%97%E6%B3%95/" class="post-title-link" itemprop="url">Knuth 洗牌算法</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2022-08-10 22:54:52 / 修改时间：23:46:57" itemprop="dateCreated datePublished" datetime="2022-08-10T22:54:52+08:00">2022-08-10</time>
            </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>394</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>1 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>有时会遇到这样的题目：<strong>设计一个公平的洗牌算法</strong>。</p>
<p>与之类似的还有 <strong>随机打乱一个数组</strong>，其中用到的都是「随机算法」。</p>
<p>这类问题的核心在于“公平”、“随机”。</p>
<p>什么叫“公平”？</p>
<p>假设有一个长度为 $n$ 的数组（无重复元素），那么它的排列共有 $n!$ 种。</p>
<p>要做到公平，就要求<strong>等概率</strong>地返回这 $n!$ 种排列中地其中一种。</p>
<p>一种朴素的想法就是，生成所有 $n!$ 种排列，然后随机返回其中的一个。</p>
<p>毫无疑问这种算法是正确的，但是 $O(n!)$ 的时间复杂度是不可接受的，它是比指数爆炸 $2^n$ 还恐怖得多的存在。</p>
<p>换个角度思考，上面的要求等价于 <strong>每个元素等概率地出现在数组的每个位置</strong>。</p>
<p>就有了大名鼎鼎的 <strong>Knuth 洗牌算法</strong>，其实只有两行：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> nums.length - <span class="number">1</span>; i &gt;= <span class="number">0</span>; i--) &#123;</span><br><span class="line">    swap(nums, i, random.nextInt(i + <span class="number">1</span>));</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>这两行代码就可以完成上述的目的。</p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://www.jnxss.top/2022/07/28/%E3%80%90SpringCloud%E3%80%91feign.codec.EncodeException%20No%20qualifying%20bean%20of%20type/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/my-avatar.png">
      <meta itemprop="name" content="江南笑书生">
      <meta itemprop="description" content="心怀梦想，永远奋斗">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="江南笑书生">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2022/07/28/%E3%80%90SpringCloud%E3%80%91feign.codec.EncodeException%20No%20qualifying%20bean%20of%20type/" class="post-title-link" itemprop="url">【SpringCloud】feign.codec.EncodeException No qualifying bean of type</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2022-07-28 20:11:52" itemprop="dateCreated datePublished" datetime="2022-07-28T20:11:52+08:00">2022-07-28</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2023-04-22 11:06:15" itemprop="dateModified" datetime="2023-04-22T11:06:15+08:00">2023-04-22</time>
              </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>1.5k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>1 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h2 id="错误描述"><a href="#错误描述" class="headerlink" title="错误描述"></a>错误描述</h2><p>在 Spring Cloud 项目中通过 Open Feign 远程调用时出现如下错误：</p>
<figure class="highlight stylus"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">feign<span class="selector-class">.codec</span><span class="selector-class">.EncodeException</span>: No qualifying bean of type <span class="string">&#x27;org.springframework.boot.autoconfigure.http.HttpMessageConverters&#x27;</span> available: expected at least <span class="number">1</span> bean which qualifies as autowire candidate. Dependency annotations: &#123;@org<span class="selector-class">.springframework</span><span class="selector-class">.beans</span><span class="selector-class">.factory</span><span class="selector-class">.annotation</span><span class="selector-class">.Autowired</span>(required=true)&#125;</span><br><span class="line">...</span><br></pre></td></tr></table></figure>

<p>Spring Cloud 版本：Hoxton.SR9</p>
<p>Spring Cloud Alibaba 版本：2.2.2.RELEASE</p>
<p>Spring Boot 版本：2.3.7.RELEASE</p>
<h2 id="错误原因"><a href="#错误原因" class="headerlink" title="错误原因"></a>错误原因</h2><p>从报错信息中不难看出，错误原因是容器中缺少 <code>HttpMessageConverters</code> 这样一个 bean 对象。</p>
<p>GitHub 上 <a target="_blank" rel="noopener" href="https://github.com/spring-cloud/spring-cloud-openfeign">spring-cloud&#x2F;spring-cloud-openfeign</a> 与此相关的 issue：<a target="_blank" rel="noopener" href="https://github.com/spring-cloud/spring-cloud-openfeign/issues/235%E3%80%82">https://github.com/spring-cloud/spring-cloud-openfeign/issues/235。</a></p>
<p>在 spring-boot-autoconfigure 的较新版本中（具体哪个版本我也不知道），<code>HttpMessageConverters</code> 的自动配置条件更改了，可以参见 <code>HttpMessageConvertersAutoConfiguration</code> 类：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 这里省去了其他无关注解</span></span><br><span class="line"><span class="meta">@ConditionalOnClass(&#123;HttpMessageConverter.class&#125;)</span></span><br><span class="line"><span class="meta">@Conditional(&#123;HttpMessageConvertersAutoConfiguration.NotReactiveWebApplicationCondition.class&#125;)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">HttpMessageConvertersAutoConfiguration</span> &#123;&#125;</span><br></pre></td></tr></table></figure>

<p>因为现在的 Spring Cloud Gateway 是基于 WebFlux 的，是 Reactive Web。所以根据 <code>@Conditional</code> 的条件，<code>HttpMessageConvertersAutoConfiguration</code> 就不会生效，进而也不会进行自动配置，就导致容器中缺少 <code>HttpMessageConverters</code> 对象。</p>
<p><img src="http://cdn.jnxss.top/Snipaste_2023-02-28_19-42-44.png"></p>
<h2 id="解决方案"><a href="#解决方案" class="headerlink" title="解决方案"></a>解决方案</h2><p>这个问题解决方法也很简单，只需自己写一个配置类，向容器中注册一个 <code>HttpMessageConverters</code> 对象即可。方法可以从 <code>HttpMessageConvertersAutoConfiguration</code> 中复制。参考如下：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Configuration</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">FeignConfig</span> &#123;</span><br><span class="line">    <span class="meta">@Bean</span></span><br><span class="line">    <span class="meta">@ConditionalOnMissingBean</span></span><br><span class="line">    <span class="keyword">public</span> HttpMessageConverters <span class="title function_">messageConverters</span><span class="params">(ObjectProvider&lt;HttpMessageConverter&lt;?&gt;&gt; converters)</span> &#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">HttpMessageConverters</span>(converters.orderedStream().collect(Collectors.toList()));</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>重启项目，问题解决。</p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://www.jnxss.top/2022/06/09/RabbitMQ%E6%8A%A5%E9%94%99%EF%BC%9AFailed-to-declare-queue-s/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/my-avatar.png">
      <meta itemprop="name" content="江南笑书生">
      <meta itemprop="description" content="心怀梦想，永远奋斗">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="江南笑书生">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2022/06/09/RabbitMQ%E6%8A%A5%E9%94%99%EF%BC%9AFailed-to-declare-queue-s/" class="post-title-link" itemprop="url">RabbitMQ报错：Failed to declare queue(s)</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2022-06-09 20:57:49" itemprop="dateCreated datePublished" datetime="2022-06-09T20:57:49+08:00">2022-06-09</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2023-04-22 11:06:36" itemprop="dateModified" datetime="2023-04-22T11:06:36+08:00">2023-04-22</time>
              </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>629</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>1 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h2 id="错误描述及原因"><a href="#错误描述及原因" class="headerlink" title="错误描述及原因"></a>错误描述及原因</h2><p>项目启动时 RabbitMQ 报错了，控制台打印一大堆就不贴了，问题的源头是：</p>
<figure class="highlight lasso"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Failed <span class="keyword">to</span> declare <span class="built_in">queue</span>(s):<span class="meta">[</span>你的消息队列名<span class="meta">]</span></span><br></pre></td></tr></table></figure>

<p>也就是说声明队列失败了。</p>
          <!--noindex-->
            <div class="post-button">
              <a class="btn" href="/2022/06/09/RabbitMQ%E6%8A%A5%E9%94%99%EF%BC%9AFailed-to-declare-queue-s/#more" rel="contents">
                阅读全文 &raquo;
              </a>
            </div>
          <!--/noindex-->
        
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://www.jnxss.top/2022/05/07/%E9%83%AD%E7%BB%A7%E6%89%BF%E8%AE%B2%E5%9B%BD%E8%BF%90/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/my-avatar.png">
      <meta itemprop="name" content="江南笑书生">
      <meta itemprop="description" content="心怀梦想，永远奋斗">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="江南笑书生">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2022/05/07/%E9%83%AD%E7%BB%A7%E6%89%BF%E8%AE%B2%E5%9B%BD%E8%BF%90/" class="post-title-link" itemprop="url">郭继承讲国运</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2022-05-07 18:13:36" itemprop="dateCreated datePublished" datetime="2022-05-07T18:13:36+08:00">2022-05-07</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2023-04-22 11:41:59" itemprop="dateModified" datetime="2023-04-22T11:41:59+08:00">2023-04-22</time>
              </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>2.1k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>2 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p><strong>声明：</strong>本系列文稿整理自抖音 <a target="_blank" rel="noopener" href="https://www.douyin.com/user/MS4wLjABAAAASItWatcvP39u6tmsaEelgHny-HfqV50Pcg2mmtwk0Ck">@吾纪录</a> 发布的中国政法大学马克思主义学院郭继承教授的系列视频，对口头讲述内容进行了书面整理，并不是逐字对应，但保证没有篡改原意。<strong>仅供学习，如觉有不妥，请联系删除</strong>。</p>
<p><img src="http://cdn.jnxss.top/%E5%9B%BD%E8%BF%90%E7%BA%BF.png" alt="国运线"></p>
<p>&amp;emsp;&amp;emsp;在人类三四千年的历史长河中，中国绝大多数的时间都在人类文明的第一梯队。大汉时期，那有拓疆万里的雄心；盛唐的时候，那有融汇天下为我所用的气派。同时代的欧洲，它的文明程度、社会治理，方方面面中国走在前面。这是事实，没有什么好抬杠的。盛唐女孩的衣服，胸下围一道绳子束着，下面敞开没有束缚。我吃多少，多么健硕，什么腰粗不粗，你管得着吗？“人面不知何处去，桃花依旧笑春风”。同时代的欧洲和中国比，在欧洲你笑春风一次？你的后果很严重。在欧洲所有的说法只要跟它的宗教不一致、跟教皇说的不一致，烤死，布鲁诺只是其中之一。还有的喝水把肚子喝得很大，然后用石头猛撞肚子。各种处罚人，称之为“黑暗的中世纪”。所以欧洲的文明程度没有中国高，中国历史两千多年没有出现神权压抑人权。中国历史上有王权对人性的压抑，但神权控制人，严格意义上没有出现。</p>
<p>大家读唐诗的时候，都是那个时代人的精神风貌。李白写诗：“君不见黄河之水天上来，奔流到海不复回”。离别的时候一般人都伤感，可是在大唐气象里面，离别的时候都可以拍手唱歌，“李白乘舟将欲行，忽闻岸上踏歌声，桃花潭水深千尺，不及汪伦送我情。”，“海内存知己，天涯若比邻”。王维的诗：“九天阊阖开宫殿，万国衣冠拜冕旒”，那是唐朝气象。</p>
<p>到了宋代的时候，中国整个气象的开阔仍然有。李清照的词你们都读过吧，那种心情的舒展。“常记溪亭日暮，沉醉不知归路。兴尽晚回舟，误入藕花深处。争渡，争渡，惊起一滩鸥鹭。”少男少女在一起喝酒啊、划拳行令啊，兴尽晚回舟，乘舟的时候还要比看谁快，争渡争渡。那个时候也没有那么多约束，要男孩女孩授受不亲啦，乱了风俗？没有这种说法吧，而且很高兴还写诗。</p>
<p>可是朋友们，后来中国的生命力就开始萎缩。到了宋代以后，贞节牌坊开始出现了。这个贞节牌坊，我是这样看待的，比如有的女同志她的丈夫去世了，这个女同事觉得哎呀我也不想再嫁了，那么这种人有个贞节牌坊，我不想再嫁了，行不行？当然行了，人家的自由嘛。而有的女同志丈夫去世以后自己生活不方便，还想再嫁，可以不可以？当然可以了，这怎么了。可是那个时候就不行，沉重的枷锁就束缚了。衣服从盛唐时期那个状态往上收了，到了明朝的时候变成领子剩一点小口。到了清朝的时候，没了，什么都看不到。衣服表现了一个民族在走向封闭、走向僵化、走向保守。在明朝中后期以后，海禁；清朝以后，文字狱。</p>
<p>同时代的欧洲和中国比，比我们怎样呢？中国的国运，我们从南宋的节点就开始往下走了，思想被束缚了，活力被束缚了，就衰败了。但是人家欧洲，从十三世纪、十四世纪一步一步地在冲破两个枷锁，一个是神权一个是王权。有个人叫但丁，但丁写神曲的时候，你们有没有发现他在地狱里边给谁留了个位置？教皇。敢在地狱里给教皇留位置，掀开了向神权进行清算的西方文艺复兴的序幕。有一个画家叫达芬奇画了个谁？蒙娜丽莎。有人说蒙娜丽莎的微笑多么漂亮，我说你的审美很宽容。蒙娜丽莎的微笑不是它美，是它在思想史和哲学史上的地位。原来的画，只能画圣母、天使。而达芬奇把一个家庭妇女当做绘画的主题，说明西方的思想和画家的笔端开始从遥远的天国拉向了人间，这是它的意义。梵高的向日葵，挣扎、扭曲，向日葵为什么这样？向日葵什么样都不重要，这是梵高心中的向日葵。梵高这么画，说明人苏醒了。西方人开始挣破神权的束缚，开始把人的尊严和自由给呼喊出来。这就是文艺复兴。</p>
<p>文艺复兴、启蒙运动、宗教改革，三个合在一起，思想的缺口打开了；法国大革命、光荣革命、美国独立战争，政治制度打开了；工业革命，科技的创造打开了；亚当·斯密的《国富论》，市场经济打开了。</p>
<p>哎呀同学们，两三千年不如我们的欧美，野蛮增长。为什么说野蛮增长呢？马克思对它的评价就是：资产阶级来到世间的一百年创造的财富，比以往历史所有总和都多。西方资本主义社会来到人间，创造那么多财富，可是它带给我们人类太多的血腥，中国就是受害者。帝国主义对我们民族的灾难和罪恶，罄竹难书。</p>
<p>中华民族到了十七世纪，其实也开始突破了。黄宗羲有没有反思两三千年中国存在的专制制度？顾炎武反思了没有？王夫之反思了没有？方以智都在反思。历史都在这个突破口。只可惜十七世纪发生一件什么事？清军入关。李自成被灭了以后，1644 年顺治皇帝在北京称帝。哎呀同学们，这一次中国的历史在即将突破的时候，一个比中原地区的文明和治理程度远远落后的游牧部落占领中国了。这就是历史，没法改。那么清朝它占领中国以后，它没有接着明朝、接着黄宗羲王夫之往前走，没有对以前两千多年制度进行清算、创造一个新的文明体系。没有，反而回去了，更加比旧制度还要封闭。这一下不要紧，中西方的差距一下子拉开了。我们踽踽独行，被时代远远抛开了。当然了，瘦死的骆驼比马大，毕竟两三千年的沉淀。太阳将要落山的时候，也有一抹彩霞，映得满天通红。那一抹彩霞真的很艳丽啊，康乾盛世。可是朋友们，晚霞消失以后，是我们这个民族无尽的黑暗，同胞的挣扎和血泪。</p>
<p>那么这个时候，一旦跟西方交手，真的是溃不成军。为什么？</p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://www.jnxss.top/2022/05/04/%E6%96%B0%E5%8D%8E%E7%A4%BE%E5%BC%A0%E6%89%AC/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/my-avatar.png">
      <meta itemprop="name" content="江南笑书生">
      <meta itemprop="description" content="心怀梦想，永远奋斗">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="江南笑书生">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2022/05/04/%E6%96%B0%E5%8D%8E%E7%A4%BE%E5%BC%A0%E6%89%AC/" class="post-title-link" itemprop="url">年轻时写日记要藏好，不然就被出版了</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2022-05-04 10:46:58" itemprop="dateCreated datePublished" datetime="2022-05-04T10:46:58+08:00">2022-05-04</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2023-04-22 11:43:22" itemprop="dateModified" datetime="2023-04-22T11:43:22+08:00">2023-04-22</time>
              </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>2k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>2 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p><strong>声明：</strong>本文是新华社记者张扬 <a target="_blank" rel="noopener" href="https://space.bilibili.com/633264591">@小羊在鲜花舍</a> 在五四青年节之际发布的一条视频 【<a target="_blank" rel="noopener" href="https://www.bilibili.com/video/BV1na411a7nK">年轻时写日记要藏好，不然就被出版了</a>】 的文字版。我觉得写得很好，既可以平常当作小文章读读，也可以在写作时参考借鉴。<strong>仅供学习使用，如觉有不妥，可联系删除</strong>。</p>
<blockquote>
<p>一日晴…… 晚子英来，招之至广和居饮。</p>
<p>二十六日…… 归途过临记洋行买饼饵少许。</p>
<p>三日…… 过稻香村买饼干一元。</p>
<p>——《鲁迅日记》</p>
</blockquote>
<p>&emsp;&emsp;如果你可以穿越百年，和那时的青年对话，你会聊些什么呢？是聊诗词歌赋，还是谈谈人生哲学？其实，和他们的共同语言，比想象中要多得多。<p>
          <!--noindex-->
            <div class="post-button">
              <a class="btn" href="/2022/05/04/%E6%96%B0%E5%8D%8E%E7%A4%BE%E5%BC%A0%E6%89%AC/#more" rel="contents">
                阅读全文 &raquo;
              </a>
            </div>
          <!--/noindex-->
        
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://www.jnxss.top/2022/03/23/Swagger%E6%8A%A5%E9%94%99%EF%BC%9AIllegal-DefaultValue-null-for-parameter-type-number/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/my-avatar.png">
      <meta itemprop="name" content="江南笑书生">
      <meta itemprop="description" content="心怀梦想，永远奋斗">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="江南笑书生">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2022/03/23/Swagger%E6%8A%A5%E9%94%99%EF%BC%9AIllegal-DefaultValue-null-for-parameter-type-number/" class="post-title-link" itemprop="url">Swagger报错：Illegal DefaultValue null for parameter type number</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2022-03-23 17:15:09" itemprop="dateCreated datePublished" datetime="2022-03-23T17:15:09+08:00">2022-03-23</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-04-17 20:14:00" itemprop="dateModified" datetime="2022-04-17T20:14:00+08:00">2022-04-17</time>
              </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>2.6k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>2 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h3 id="报错信息"><a href="#报错信息" class="headerlink" title="报错信息"></a>报错信息</h3><p>今天启动项目打开 Swagger 文档的时候，突然报了这么个错误：</p>
<figure class="highlight stylus"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">i</span><span class="selector-class">.s</span><span class="selector-class">.m</span><span class="selector-class">.p</span><span class="selector-class">.AbstractSerializableParameter</span> : Illegal DefaultValue null <span class="keyword">for</span> parameter type number</span><br><span class="line">java<span class="selector-class">.lang</span><span class="selector-class">.NumberFormatException</span>: empty String</span><br><span class="line">......</span><br></pre></td></tr></table></figure>

<p>或者像这样：</p>
<figure class="highlight stylus"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">i</span><span class="selector-class">.s</span><span class="selector-class">.m</span><span class="selector-class">.p</span><span class="selector-class">.AbstractSerializableParameter</span> : Illegal DefaultValue null <span class="keyword">for</span> parameter type integer</span><br><span class="line">java<span class="selector-class">.lang</span><span class="selector-class">.NumberFormatException</span>: For <span class="selector-tag">input</span> string: <span class="string">&quot;&quot;</span></span><br><span class="line">...</span><br></pre></td></tr></table></figure>

<p>然而程序运行一切正常，检查代码也没发现什么错误，最后锁定到了 Swagger 身上。</p>
          <!--noindex-->
            <div class="post-button">
              <a class="btn" href="/2022/03/23/Swagger%E6%8A%A5%E9%94%99%EF%BC%9AIllegal-DefaultValue-null-for-parameter-type-number/#more" rel="contents">
                阅读全文 &raquo;
              </a>
            </div>
          <!--/noindex-->
        
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://www.jnxss.top/2022/02/15/Java-JWT-%E7%9A%84%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/my-avatar.png">
      <meta itemprop="name" content="江南笑书生">
      <meta itemprop="description" content="心怀梦想，永远奋斗">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="江南笑书生">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2022/02/15/Java-JWT-%E7%9A%84%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/" class="post-title-link" itemprop="url">Java JWT 的基本使用</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2022-02-15 19:37:26 / 修改时间：20:11:41" itemprop="dateCreated datePublished" datetime="2022-02-15T19:37:26+08:00">2022-02-15</time>
            </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>3.1k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>3 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>JWT，JSON Web Token</p>
<p><img src="http://jwt.io/img/logo-asset.svg"> </p>
          <!--noindex-->
            <div class="post-button">
              <a class="btn" href="/2022/02/15/Java-JWT-%E7%9A%84%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/#more" rel="contents">
                阅读全文 &raquo;
              </a>
            </div>
          <!--/noindex-->
        
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://www.jnxss.top/2021/10/21/%E4%BD%8D%E8%BF%90%E7%AE%97/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/my-avatar.png">
      <meta itemprop="name" content="江南笑书生">
      <meta itemprop="description" content="心怀梦想，永远奋斗">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="江南笑书生">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/10/21/%E4%BD%8D%E8%BF%90%E7%AE%97/" class="post-title-link" itemprop="url">位运算</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2021-10-21 10:16:16 / 修改时间：10:44:02" itemprop="dateCreated datePublished" datetime="2021-10-21T10:16:16+08:00">2021-10-21</time>
            </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>292</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>1 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>位运算这种东西，代码一般比较简单，但比较难想到。属于是见过就会，没见过就不会那种。而且比较难记住，很容易记错记混。</p>
<h2 id="位运算模拟加法"><a href="#位运算模拟加法" class="headerlink" title="位运算模拟加法"></a>位运算模拟加法</h2><p>设两个数字的二进制形式为 $a$、$b$，其和 $s&#x3D;a+b$，$a(i)$ 表示 $a$ 的二进制第 $i$ 位。</p>
<table>
<thead>
<tr>
<th align="center">$a(i)$</th>
<th align="center">$b(i)$</th>
<th align="center">无进位和 $n(i)$</th>
<th align="center">进位 $c(i+1)$</th>
</tr>
</thead>
<tbody><tr>
<td align="center">0</td>
<td align="center">0</td>
<td align="center">0</td>
<td align="center">0</td>
</tr>
<tr>
<td align="center">0</td>
<td align="center">1</td>
<td align="center">1</td>
<td align="center">0</td>
</tr>
<tr>
<td align="center">1</td>
<td align="center">0</td>
<td align="center">1</td>
<td align="center">0</td>
</tr>
<tr>
<td align="center">1</td>
<td align="center">1</td>
<td align="center">0</td>
<td align="center">1</td>
</tr>
</tbody></table>
<p>规律就是：对单个数位而言，<strong>异或结果就是无进位和，与运算结果就是进位</strong>（因为是进位，还需左移一位）。</p>
<p>位运算模拟加法的公式就是：<code>(a^b) ^ ((a&amp;b)&lt;&lt;1)</code>，循环这个过程，直到进位为 0。</p>
<p>例题：<a target="_blank" rel="noopener" href="https://leetcode-cn.com/problems/bu-yong-jia-jian-cheng-chu-zuo-jia-fa-lcof/">剑指 Offer 65. 不用加减乘除做加法</a> </p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://www.jnxss.top/2021/08/28/%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/my-avatar.png">
      <meta itemprop="name" content="江南笑书生">
      <meta itemprop="description" content="心怀梦想，永远奋斗">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="江南笑书生">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/08/28/%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95/" class="post-title-link" itemprop="url">排序算法</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-08-28 16:20:13" itemprop="dateCreated datePublished" datetime="2021-08-28T16:20:13+08:00">2021-08-28</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2021-09-06 21:02:09" itemprop="dateModified" datetime="2021-09-06T21:02:09+08:00">2021-09-06</time>
              </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>4.3k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>4 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h2 id="排序算法"><a href="#排序算法" class="headerlink" title="排序算法"></a>排序算法</h2><p>虽然实践中排序通常都会直接调用库方法，但是一些排序算法的思想还是要学习的，设计得很巧妙。</p>
<p>重点学习：快速排序、归并排序、堆排序。</p>
          <!--noindex-->
            <div class="post-button">
              <a class="btn" href="/2021/08/28/%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95/#more" rel="contents">
                阅读全文 &raquo;
              </a>
            </div>
          <!--/noindex-->
        
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  


  
  <nav class="pagination">
    <span class="page-number current">1</span><a class="page-number" href="/page/2/">2</a><a class="extend next" rel="next" href="/page/2/"><i class="fa fa-angle-right" aria-label="下一页"></i></a>
  </nav>



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="江南笑书生"
      src="/images/my-avatar.png">
  <p class="site-author-name" itemprop="name">江南笑书生</p>
  <div class="site-description" itemprop="description">心怀梦想，永远奋斗</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">17</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">13</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/5ME" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;5ME" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:cplasfyin@163.com" title="E-Mail → mailto:cplasfyin@163.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
      <span class="links-of-author-item">
        <a href="/images/qq.png" title="QQ → &#x2F;images&#x2F;qq.png"><i class="fab fa-qq fa-fw"></i>QQ</a>
      </span>
      <span class="links-of-author-item">
        <a href="/images/wechat.jpg" title="WeChat → &#x2F;images&#x2F;wechat.jpg"><i class="fab fa-weixin fa-fw"></i>WeChat</a>
      </span>
  </div>
  <div class="cc-license motion-element" itemprop="license">
    <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" rel="noopener" target="_blank"><img src="/images/cc-by-nc-sa.svg" alt="Creative Commons"></a>
  </div>



      </div>
        <div class="back-to-top motion-element">
          <i class="fa fa-arrow-up"></i>
          <span>0%</span>
        </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        
  <div class="beian"><a href="https://beian.miit.gov.cn/" rel="noopener" target="_blank">豫ICP备2022008411号 </a>
      <img src="/images/%E5%A4%87%E6%A1%88%E5%9B%BE%E6%A0%87.png" style="display: inline-block;"><a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=41062102410658" rel="noopener" target="_blank">豫公网安备 41062102410658号 </a>
  </div>

<div class="copyright">
  
  &copy; 2020 – 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-heartbeat"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">江南笑书生</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-area"></i>
    </span>
    <span title="站点总字数">84k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">1:16</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

        
<div class="busuanzi-count">
  <script data-pjax async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/pjax/pjax.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/pangu@4/dist/browser/pangu.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>

  <script>
var pjax = new Pjax({
  selectors: [
    'head title',
    '#page-configurations',
    '.content-wrap',
    '.post-toc-wrap',
    '.languages',
    '#pjax'
  ],
  switches: {
    '.post-toc-wrap': Pjax.switches.innerHTML
  },
  analytics: false,
  cacheBust: false,
  scrollTo : !CONFIG.bookmark.enable
});

window.addEventListener('pjax:success', () => {
  document.querySelectorAll('script[data-pjax], script#page-configurations, #pjax script').forEach(element => {
    var code = element.text || element.textContent || element.innerHTML || '';
    var parent = element.parentNode;
    parent.removeChild(element);
    var script = document.createElement('script');
    if (element.id) {
      script.id = element.id;
    }
    if (element.className) {
      script.className = element.className;
    }
    if (element.type) {
      script.type = element.type;
    }
    if (element.src) {
      script.src = element.src;
      // Force synchronous loading of peripheral JS.
      script.async = false;
    }
    if (element.dataset.pjax !== undefined) {
      script.dataset.pjax = '';
    }
    if (code !== '') {
      script.appendChild(document.createTextNode(code));
    }
    parent.appendChild(script);
  });
  NexT.boot.refresh();
  // Define Motion Sequence & Bootstrap Motion.
  if (CONFIG.motion.enable) {
    NexT.motion.integrator
      .init()
      .add(NexT.motion.middleWares.subMenu)
      .add(NexT.motion.middleWares.postList)
      .bootstrap();
  }
  NexT.utils.updateSidebarPosition();
});
</script>




  




  
<script src="//cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js"></script>
<script src="//cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js"></script>
<script src="/js/algolia-search.js"></script>














    <div id="pjax">
  

  

  

    </div>
</body>
</html>
